<script type="text/javascript">
    var styles = [
        { title: 'Small', inline: 'small' },
        { title: 'Code', format: 'code' },
        { title: 'Lead', block: 'p', classes: 'lead' },
        { title: 'Button', inline: 'a', classes: 'btn btn-sm btn-default' }
    ];

    function addFormEditor(selector) {
        tinymce.init({
            selector: selector,
            menubar: false,
            branding: false,
            convert_urls: false,
            plugins: [
                "autoresize autolink code hr paste lists piranhaimage piranhalink"
            ],
            width: "100%",
            height: "300",
            autoresize_min_height: 340,
            content_css: ["//fonts.googleapis.com/css?family=Gentium+Book+Basic:700", "//fonts.googleapis.com/css?family=Open+Sans:300,400,600", "@Url.Content("~/manager/assets/css/editor.min.css")"],
            toolbar: "bold italic | bullist numlist hr | alignleft aligncenter alignright | formatselect styleselect | piranhalink piranhaimage",
            block_formats: 'Paragraph=p;Header 1=h1;Header 2=h2;Header 3=h3;Header 4=h4;Preformatted=pre;Quote=blockquote',
            style_formats: styles,
            setup: function (editor) {
                editor.on('change', function () {
                    editor.save();
                });
            }
        });
    }

    function addInlineEditor(selector) {
        tinymce.init({
            selector: selector,
            menubar: false,
            branding: false,
            statusbar: false,
            inline: true,
            convert_urls: false,
            plugins: [
                "autoresize autolink code hr paste lists piranhaimage piranhalink"
            ],
            width: "100%",
            autoresize_min_height: 0,
            toolbar: "bold italic | bullist numlist hr | alignleft aligncenter alignright | formatselect styleselect | piranhalink piranhaimage",
            block_formats: 'Paragraph=p;Header 1=h1;Header 2=h2;Header 3=h3;Header 4=h4;Preformatted=pre;Quote=blockquote',
            style_formats: styles
        });
    }

    addFormEditor('textarea.editor');
    addInlineEditor('div.block-editor');
</script>
